$(function(){
	$('.wrapper-manage-search').contextmenu({
		target : "#search-context-menu",
		onItem : function(context, e) {
			var expr = $(e.target).text().trim();
		},
		before: function (e) {
			if (!$(e.target).parent().hasClass('selected')){
				$(e.target).parent().click();
			}
			if ($('#documentNameSelect').val() === ""){
				e.preventDefault();
				this.closemenu();
				return false;
			}
        }
	});
	$('.wrapper-manage-search').on('contextmenu', function(e) {
		e.preventDefault();
		if ($('#documentNameSelect').val() === ""){
		
		}
	});
	$('#search-context-menu').on('show.bs.context', function(e) {
		console.log('before show event');
	});
	
	$('#search-context-menu').on('shown.bs.context', function(e) {
		console.log('after show event');
	});
	
	$('#search-context-menu').on('hide.bs.context', function(e) {
		console.log('before hide event');
	});
	
	$('#search-context-menu').on('hidden.bs.context', function(e) {
		console.log('after hide event');
	});
});